namespace Billing.Controls
{
    using Billing;
    using System;
    using System.Data;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class ucPageTitle : UserControl
    {
        protected Label lblTitle;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.Page.IsPostBack && (LoginUser.TreeMenu != null))
            {
                ClsTreeHelper clsTree = new ClsTreeHelper();
                string PageName = this.Page.ToString().Substring(4, this.Page.ToString().Substring(4).Length - 5) + ".aspx";
                DataView dv = new DataView(LoginUser.TreeMenu) {
                    RowFilter = " PageUrl = '" + PageName + "'"
                };
                if (dv.Count > 0)
                {
                    this.lblTitle.Text = dv[0]["ResourceName"].ToString();
                }
            }
        }

        public string PageName
        {
            set
            {
                this.lblTitle.Text = value;
            }
        }
    }
}
